<template>
  <view class="qd" >
  <image :src="qd"></image>
  </view>
</template>

<script>
	import  Sqlite  from '@/utils/sqlex.js'
	import uploadurl from "@/config/index.js"
		import { logs } from '@/request/setarticle.js'
import dlpage from '@/pages/index/index.vue'
import sypage from '@/pages/home/index.vue'
import websocketManager  from '@/websocketService.js'
export default {
  components: {
    dlpage,
	sypage
  },
  data() {
    return {
		dbName: '',
		dbPath: '',
      showSplash: true,
	  qd:require('@/static/qd.png'),
    };
  },
  created() {
	  let message = Number(this.$store.state.messagenum)
	  if(message>0){
		  uni.setTabBarBadge({ //显示数字
		  	index: 1, //tabbar下标
		  	text:message>99?'99+':`${message}`//数字
		  })
	  }
	
	 let dbName=`sqlchat_${this.$store.state.id}`
	let dbPath=`_doc/dianji_${this.$store.state.id}.db`
	 const token = uni.getStorageSync('token');
	 if (token) {
	Sqlite.openSqlite(dbName,dbPath)
	 this.$store.dispatch('startTokenCheck');
	 websocketManager.init(`${uploadurl.baseUrl}?${this.$store.state.id}`);
	   // 如果存在token，跳转到首页
	  uni.switchTab({
	         url: '/pages/home/index' // 注意路径格式  
	       });  
	 } else {
		 console.log("进入登录页面")
	   // 如果不存在token，跳转到登录页
	   uni.reLaunch({
	   	url: '/pages/index/index' // 注意路径格式  
	   });
	 }
	  },
	  methods:{
		  
	  }
};
</script>

<style lang="scss" scoped>
	.qd{
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		image{
			height: 100%;
			width: 100%;
		}
	}
/* 你的全局样式 */
</style>